package com.design.behavior.observer.cainiao;

/**
 * @ProjectName: design
 * @Package: com.design.behavior.observer.cainiao
 * @ClassName: BinaryObserver
 * @Author: shenaiguo
 * @Description: 创建实体观察者类。
 * @Date: 2020/11/23 0023 20:28
 */
 // 步驟3
public class BinaryObserver extends Observer {
    public BinaryObserver(Subject subject){
        this.subject = subject;
        this.subject.attach(this);
    }

    @Override
    public void update() {
        System.out.println( "Binary String: "
                + Integer.toBinaryString( subject.getState() ) );
    }
}
